from django.db import models

class ArticleCategory(models.Model):
    name = models.CharField(max_length=10)

class Article(models.Model):
    title = models.CharField(max_length=200)
    desc = models.CharField(max_length=200)
    thumbnail = models.URLField()
    content = models.TextField()
    pub_time = models.DateTimeField(auto_now_add=True)
    is_delete = models.BooleanField(default=False)
    category = models.ForeignKey('ArticleCategory',on_delete=models.SET_NULL,null=True)
    author = models.ForeignKey('linlinauth.User',on_delete=models.SET_NULL,null=True)

    class Meta:
        ordering = ['-pub_time']